package com.qiaofang.common.config;

import com.qiaofang.common.utils.StringUtil;
import lombok.Data;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 * @author jianhua.song
 */
@Data
@Component
public class SystemConfig {

    public static String uploadFileUrl;

    public static String env;

    public static String v10Url;

    public static String appId;

    public static String appKey;

    public static  final String saveFirsthandEstate = "v1/fyapi/firsthandEstate/saveFirsthandEstate";

    public static  final String deleteFirsthandEstate = "v1/fyapi/firsthandEstate/deleteFirsthandEstate";

    public static  final String updateFirsthandIntentionAuditStatus = "v1/fyapi/firsthandEstate/updateFirsthandIntentionAuditStatus";

    public static  final String saveFirsthandEstateDynamic = "v1/fyapi/firsthandEstate/saveFirsthandEstateDynamic";


    @SuppressWarnings("static-access")
    @Value("${uploadFile.url}")
    public void setUploadFileUrl(String uploadFileUrl) {
        SystemConfig.uploadFileUrl = uploadFileUrl;
    }

    @Value("${spring.profiles.active}")
    public void setEnv(String env) {
        SystemConfig.env = env;
    }

    @Value("${bomc.v10-url}")
    public void setV10Url(String v10Url) {
        SystemConfig.v10Url = v10Url;
    }

    @Value("${bomc.app-id}")
    public void setAppId(String appId) {
        SystemConfig.appId = appId;
    }

    @Value("${bomc.app-key}")
    public void setAppKey(String appKey) {
        SystemConfig.appKey = appKey;
    }

    private static final String PRO = "pro";

    public static boolean isProEnv() {
        if (StringUtil.equals(env, PRO)) {
            return true;
        } else {
            return false;
        }
    }

    public static void test() {
        System.out.println(uploadFileUrl);
    }

}
